package com.abc.qq.view.tcp2;

import java.io.IOException;
import java.io.InputStream;
import java.net.Socket;

public class ServerChatThread implements Runnable{
    private Socket socket;
    public ServerChatThread(Socket socket) {
        this.socket = socket;
    }
    @Override
    public void run() {
        while(true){
            try {
                InputStream is = socket.getInputStream();
                byte[] cache = new byte[10];
                is.read(cache);
                MyServer2.stus.put(socket.getInetAddress().getHostAddress(),new String(cache).trim());
                System.out.println(socket.getInetAddress().getHostAddress()+" "+new String(cache).trim());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }

        }
    }
}
